﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;


namespace WpfMvvmDemo.Models
{
    /// <summary>
    /// 测试Model
    /// </summary>
    public class TestModel:ObservableObject    
    {
        /// <summary>
        /// 姓名
        /// </summary>
        private string name = "测试1";
        public string Name
        {
            get => name;
            set => SetProperty(ref name, value);
        }

        /// <summary>
        /// 性别
        /// </summary>
        private string gender = "男";
        public string Gender
        {
            get => gender;
            set => SetProperty(ref gender, value);
        }

        /// <summary>
        /// 年龄
        /// </summary>
        private int age = 18;
        public int Age
        {
            get => age;
            set => SetProperty(ref age, value);
        }

        /// <summary>
        /// 分析
        /// </summary>
        public Action<TestModel> AnalysisReportAction;

        private RelayCommand analysisReportCommand;
        public RelayCommand AnalysisReportCommand
        {
            get
            {
                if (analysisReportCommand == null)
                {
                    analysisReportCommand = new RelayCommand(() =>
                    {
                        AnalysisReportAction?.Invoke(this);
                    });
                }
                return analysisReportCommand;
            }
        }

        public TestModel()
        {
            
        }
    }
}
